package com.base.autoproxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author HBZ
 * @Date 2020/11/4 9:13
 * @Description
 */
public class JDKProxyInvocationHandler implements InvocationHandler {
    private Object target;

    public JDKProxyInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method,
                         Object[] args) throws Throwable {
        System.out.println("执行前");
        Object result = method.invoke(this.target, args);
        System.out.println("执行后");
        return result;
    }
}
